package com.handl.springcloud;

import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.context.config.annotation.RefreshScope;
import org.springframework.cloud.netflix.eureka.EnableEurekaClient;
import org.springframework.context.annotation.Bean;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.client.RestTemplate;

@SpringBootApplication
@RestController
//开启服务注册到注册中心
@EnableEurekaClient
//开启自动刷新功能支持
@RefreshScope
public class ConfigclientApplication {

	public static void main(String[] args) {
		SpringApplication.run(ConfigclientApplication.class, args);
	}

//	@Value("${foo}")
//	String foo;

	@Value("${name}")
	String name;
	@Value("${age}")
	int age;
	@Value("${des}")
	String des;

	@RequestMapping("getConfigData")
	public String getConfigData(){
		return name+","+age+","+des;
	}


	@Bean
	RestTemplate restTemplate(){
		return new RestTemplate();
	}
}
